home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume91
/
utilitys
/
print15a
/
part02
/
print.doc
< prev
Wrap
Text File
|
1991-03-14
|
20KB
|
424 lines
**************************************************************************
P R I N T D O C U M E N T A T I O N
V E R S I O N 1 . 5A
**************************************************************************
1 WHY DID I WRITE PRINT?
Well, this might be considered an intelligent question if you look at
the thousands of different printer drivers, handlers and the like that are
available in the public domain today. Well, none of them could truly solve
half of my printing problems, so I decided to write my own. I didn't want
it to be one of these fancy handler-style, deep-into-dos-an'-exec-like
programs (I'm not a capacity in this area anyway), it should just be a
relatively small and easy to handle & comprehend CLI program.
What also kinda' p.. me off was the fact that no program was really
interested in what I had set via preferences, nor did the printer behave
properly in the handling of German characters or braces and parenthesis.
There stood this fantastic piece of hardware (a P6+ in my special case),
connected to an even more fantastic computer, and I should not get what I
wanted? So I sat down and coded this thinging of which you are just now
reading the docs.
2 WHAT PRINT DOES
Print lets you sort of completely specify the output of your printer
without having to enter and change preferences every two minutes or so or
having to break your fingers to get to the dip switches of your printer.
Print will handle special German umlauts correctly and map them to their
proper values as well as intercept the thousands of form feeds that mainly
utility programmers love to put into their text files :-)
In addition Print will allow you to change type size and print quality
of your printer and lots of other neat things.
As far as I know Print is the first program for the Amiga which gets
German users both Umlauts AND brackets in one go without using the graphics
mode. If I'm wrong, please tell me so I can shoot myself...
3 RESTRICTIONS & KNOWN BUGS
Sorry for all those scientists among you who enjoy reading
broken-up-in-half lines of text on ripped perforations. I set the default
to skip this piece of paper...
Print has never been tested on any other printer than my NEC. It might
happen that errors come up if the command set is loaded by scan_file(). If
they do, please let me know.
When using different printer fonts than the IBM (yuck!) one, problems
might come up when characters are mapped.
In addition, Print does not currently map the whole IBM font correctly
to the Amiga's keymap, but this should not really pose a problem if you're
not trying to print ANSI files :-)
Print needs both the arp.library and the req.library.
4 HOW TO USE PRINT
Print is called from the CLI with the command line
1> Print [options] {switches} file1 ... file20
you can mix up options, switches and file names to your heart's content.
Print will consider everything not beginning in a '-' (minus sign) as a
name of a file to be processed. VERY IMPORTANT: You MUST leave a space
between an option and its argument. If you fail to comply to this rule
Print will just ignore the value and assume the default value of the
certain option. 'Print -p 45 myfile' would be a valid command line which
would set the pagelength to 45 lines of text, for instance.
Another nice feature: if you don't give a filename Print will just send
the specified options and switches to the printer. This means you are able
to adjust your printer without having to touch it. Make sure that your
printer is online when you use Print this way, otherwise Print won't return
until is is able to write the commands to the printer, e.g. the printer is
online.
5 OPTIONS AND SWITCHES
Remember, online help is available at any time by typing
Print h
to the CLI prompt. Print will then give you a brief description of the
commands and switches it knows about.
6 LIST OF OPTIONS
Options are commands which require an argument to be supplied by the
user. In order not to have to type tons of numbers to the program, I've
tried to keep the numbers of options small or at least set them to a
sensible default value. Over here in Germany, most people use fanfold
paper for example, which will take 72 lines of output without a problem,
and due to the fact that I initially wrote this program for ME :-) i set
most of the default values in such a manner that the result would please
me. Should your wishes totally diverge from mine, go and write yourself an
alias which automatically inserts your favourite options and switches.
-f file Read printer command sequences from file. See following sections
for more details.
-i This number will determine the number of blanks that
Print puts in front of each line. The range of this
value is 1 to 30, the default is 8 spaces.
-l The value given after this option sets the number of
lines on each page. Note that this value is not the
amount of lines actually written out. Some space
is kept on top and at the bottom of a page for the
optional footline. The range is 2 to 100 lines per page,
the default value is 72.
-t The argument given to this option will determine how
many spaces are written to the printer for each tab.
This is a very neat option which will make your
printouts look really nice! The range is 1--16 spaces
per tab, the default being 3.
-u This is for all you users who insist on using a different
national char set than the USA default setting. Print is
programmed in such a way that the mapping of chars will
only work properly if the printer is in USA mode. As there
is no known means of getting the printer's default char set
you use, this is the place to put the char set number. When
printing of the last file is finished, Print will tell the
printer to switch back to the specified char set.
The range of this value according to NEC specs is 0--14,
with Print's value defaulting to 2 (German char set). Omitting
this options might cause strange results when printing
listings with lots of parenthesis and the like.
To find out which number your char set is just take a look
at the printer manual.
-o This option tells Print that the print head is not exactly
at the beginning of the paper (i.e., the perforation) but is
offset by n millimeters. I chose this unit because it allows
the use of integer arithmetic, and I don't wanted Print to
get blown up by the floating point library. The option
"-o 60" would tell Print that the paper is 60 mm further down
(or up, rather) the drain than normal. The range of this value
is from 0 to 300 millimeters. If Print fails to convert your
given parameter, the default value of 62 mm is used (in the
case of the P6+ the distance from the print ruler to the
rim of the back top plastic cover).
Note that Print bases it calculations on the 6 LPI setting!
6.1 THE PRINTER COMMAND FILE
If you're not lucky enough to own a NEC, you can use the command file to
change the programs command table. Each line in this file (which you can
create using your favourite editor) must consist of five hex bytes
separated by spaces or tabs and a string at the end denoting the printer
command to be set. For example, the line
1c 48 ff 00 00 tencpi
would tell Print that your printers command for switching to 10 CPI is "1c
48". The byte "ff" is used to indicate the end of the command. Not that
even though the above command is only two bytes long you MUST give five
bytes in the line. This is due to the fact that the array is five bytes in
length to provide storage for veeeryy long commands too. Apart from that
the scanning of the command file is still done via fscanf() (yuck!!)
because I was once again too lazy to think of any other way, and especially
programmers know that this routine behaves funnier than your mother in law
if it does not get what it expects :-)
Another example: The command file line
1b 43 ff 00 00 lperpage
is the command to set the pagelengh to n lines according to the
manufacturers specs. Note that the two "00"'s are used as padding bytes to
make total byte number add up to five. When Print sends the command to set
a certain page length to the printer, it will scan the command table, write
the bytes it finds to "PAR:" until it encounters the "ff", telling it that
this is the end of the command. If the command requires an argument, Print
will send the argument directly afterwards to the printer.
Here is list of the commands the parser (hmm, well, a simple parser!)
understands:
"tencpi" --- switch to 10 CPI
"twelvecpi" --- " " 12 CPI
"fiftcpi" --- " " 15 CPI
"setquality" --- switch to NLQ
"setdraft" --- switch to High Speed Draft
"neglinefeed" --- perform a negative line feed
"loudness" --- full speed printing
"quiet" --- half speed printing
"resetprinter" --- full printer reset
"changecharusa" --- switch to USA char set
"changecharother" --- switch to other than USA set
"set8lpi" --- switch to 8LPI
"set6lpi" --- switch to 6LPI
"underline" --- set underline for file name & date
If you don't name all of these commands in the command file, Print will use
the default NEC settings for the undefined ones. This might result in some
funny characters appearing in your printout. To get rid of these just set
the sequences to harmless spaces (0x20) which end in the command end byte
"ff" or don't use them via command line switches. If your printer is not
capable of, say, quiet printing, use the command file line
ff 00 00 00 00 quiet
to prevent the appearance of funny escape characters.
The command file line
20 20 20 20 ff underline
would convert the underline command to four harmless spaces.
Oh, I forgot: ALL COMMANDS MUST CONSIST OF LOWER CASE CHARACTERS.
7 LIST OF SWITCHES
Switches don't take an argument. Put them anywhere you like!
-B Selects the "BIG" 10 cpi font.
-M " " "MEDIUM" 12cpi font (DEFAULT)
-S " " "SMALL" 15cpi font.
-F if given, the first line of the printout will be the
name of the file. The default is not to print the filenames.
Also prints the date.
-P turns on the pagenumbering. The counter will be reset to 1
after each file printed. (Default is off)
-Q this switch selects near letter quality mode of the PinWriter.
This is also the default print mode (we want our listings
to look nice, don't we?).
-D selects the draft mode (fast, but ugly, yuck!). For those
among you who are always in a terrible hurry.
-N selects quiet (half speed) print mode.
-R Inhibits resetting the printer after last file. This is for
people who trust this program!
-T If you do not want incoming characters to be mapped to their
IBM char set equivalents, use this option.
-8 Causes Print to use the 8LPI jammed print mode.
Note that the program discriminates between upper and lower case letters!
7.1 CALLING PRINT FROM THE WORKBENCH
To call Print from the Workbench double-click on its icon. At the time
this is written it's not clear wether I'll include the parameter passing.
The current version however will not accept passed parameters.
Using Print on the Workbench is a pretty straight forward job: If you
doubleclick the icon or type
1> Print15a
to the CLI prompt, print will open up a window on the Workbench screen.
The functions of Print are then controlled via the various gadgets. Note
that not all options and switches of Print are usable from this window. I
introduced this facility to provide a shortcut invocation of Print for a
fast print job where you don't have to set options like page length or
alternate national printer char set.
The rest is quite self-explanatory stuff, really. If you click around
the gadgets a bit you'll notice which values you can use from this window.
To print a file, enter your favourite settings and then click the "Print
File" gadget. This will bring up the famous ARP file requester which lets
you select the filename. When done, click the requester's "OK" gadget.
Print will then start the print job and change the print gadget's text to
"Please wait" until it is ready to take on the next job.
Print also lets you use the values that were set with Preferences, and
now you can even be sure that the values will actually be used for the
printout :-) Click on the "prefs" gadget to the right of the "info" gadget
to load the preferences settings.
Click on the "info" gadget in the upper right hand corner to get
information on the legal stuff.
If you don't need Print and want the clumsy window out of the way for a
while, just click the "Have a nap" gadget. Print will then iconify its
window and reduce the priority of its task to -10 to avoid blocking the
system (of course WaitPort is used to wait for messages!). Doubleclicking
the icon will reopen Print's window and restore priority to 0.
The "req" gadget will let you choose between arp's and the req.libraries
file requester, the default being req.library.
To get information concering the time print needs to print a file, click
the "pre" gadget and choose the file you want to print. The information
Print gives is of course only approximate and valid for the NEC P6+.
8 THE LEGAL STUFF
Print is copyright (c) HooverSoft 1990. All rights remain with the
author of this program, Uwe "Hoover" Schurkamp. Permission is granted to
distribute this program freely provided no fee is charged and that it is
distributed in its unmodified zoo file together with this documentation.
Explicit permission is granted to Fred Fish to include this program and all
its files in his library and for everyone who wants to put it on a BBS or
usenet-like facility.
If you feel this program comes in handy and if you use it on a regular
basis I ask you to make a donation to your favourite charity (Cheers, Art
Skiles, for the idea!) like Greenpeace or whatever you like. Please don't
forget to worry about this planet, the worlds that the AMIGA creates aren't
real...
9 DISCLAIMER
HooverSoft makes no warranty whatsoever to the fitness of this program for
use and disclaims liability for any damage resulting from the use of Print.
In other words: Use it if you dare!
10 PRINT REVISIONS AND SMALL HISTORY
Version 0.01:
Wouldn't dare call this a release. Just coded something because of
boredom... Introduced multiple file names and the like.
Version 1.00:
Coded help, user settable type size, interception of Form feeds and
inclusion of file names. Kicked the concept of using spool files as output
to send data directly to PAR: Also programmed settable perforation jump
(with VERY strange results). Tooks lots of pains to make Print's banner
look nice (the 'nec' stuff appears purple on my prefs, hmmm :-)
Version 1.01:
Once again kicked concept of using NEC's auto jump. Print now
'simulates' perforation skip by printing lots of \n's. Introduced option
to print out page numbers. Things seem to go quite well!
Version 1.02:
Printing quality is now user settable via -Q and -D options. Killed a
bug in the interception of ff's (Print really didn't capture them,
whooops...)
Also did some optimization on the code like getting rid of obsolete
options and the like.
Version 1.03:
Fixed a bug with first printed line that Print refused to indent.
Thoroughly tested Print's performance on a couple of really long files.
Version 1.04:
Print should now be a bit shorter (did some optimization on the code).
Removed superfluous cr after printing of last file. The paper should end
up just right now after printout. Added switches -N and -R.
Version 1.1:
Introduced a new option -u to take other national char sets into account.
Fixed a bug in the PutCommand()-routine.
There might have been a very big bug in earlier versions which could have
caused Print to not perform as advertised: I left out an init of an auto
variable which could have jammed up the command table. Well, no one has
complained so far...
The biggest improvement is perhaps the ability to load other printers
command sets. As I only have one printer, I really rely on you to point
out any error!
VERSION 1.11:
Introduced offset option and killed a bug that would cause the NEC to print
BACKWARDS if you didn't use -R switch. Boy, that's funny! Maybe I
shouldn't drink so much wine when programming... Print now resets the
printer by default. Print now also maps the "1/2" char correctly.
VERSION 1.2:
8LPI printing introduced. -T switch added. couple of other minor bug
fixes.
VERSION 1.5A:
MAJOR rewrite of Print which now looks a totally different program!
Included Workbench startup, huge requester and making use of ARP's file
requester. It's been a lot of work, but I think it has payed off in the
end, don't you think? Changes are too many to mention them in detail, so
go and find out yourselves.
11 BUGS AND FLEAS
If you find any of these ugly creatures in my great code (hu hu) worth
mentioning drop me a line on bitnet to
hoover@math4.uni-bielefeld.de
or by SNAIL to
Uwe Schurkamp
Jollenbecker Weg 4
D-4900 Herford
Print is quite a large program (for my standards anyway), and testing
all its features in combination with each other would probably use up about
half a rain forest's worth of paper. Well, I wrote Print to get rid of
tons of unsatisfying printouts, and I DO rely on my users to report any
errors.
12 THE CREDITS
Cheers to JENS MENSCHING for many bug reports and the idea to put an
Inutition interface into Print. The Print icon is by courtesy of MAGIC
MOUSE Inc. (alias BERND HEIDE, who has not yet decided to take on this
name :-) ... I really like it! Also LEO SCHWAB requires mentioning his
name in the docs if you use his iconify() routine... Thanks, Leo! (Note
for the users: If Print gurus on you when iconifying, drop Leo a line!
;-) Leo's routine is a MUST for any serious program (which doesn't mean
Print is a serious program!). Cheers also to the guys who programmed the
fantastic req.library.
Last but not least a big "thanks" to MY WIFE for allowing the time with
this great piece of technology (she couldn't play MechForce while I was
hacking...) and to MY unborn SON for delaying his arrival until I finished
this program (if there is something like a "final release" of a program).
enjoy & be lucky
hoover
P.S.: play NetHack!
___________________________________________________________________________
|---------------------------------------------------------------------------|
| Weinberg's Law: || //// Only Amiga |
| "If builders built buildings the way || //// makes it |
| programmers write programs, then the || \\\\ //// possible! |
| first woodpecker that came along || \\\X/// hoover@math4. |
| would destroy civilisation." || \XXX/ uni-bielefeld.de |
|---------------------------------------------------------------------------|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""